// [1,2,2] 返回的子集去除重复

function findchild(arr) {
    let result = []
    let temp = []
    let dep = 0;

    function dfs(temp, dep) {
        if (temp.length) result.push(temp);
        for (let i = dep; i < arr.length; i++) {
            if (i > dep && arr[i] === arr[i - 1]) continue
            temp.push(arr[i])
            dfs(temp.slice(), i + 1)
            temp.pop()
        }
    }
    dfs(temp, dep)
    return result
}

console.log(findchild([1, 2, 2]))